package com.c2soft.ncmx.exch.mains;

import java.math.BigDecimal;
import java.util.Date;

import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;

import com.c2soft.ncmx.exch.config.JmsConfigForTest;
import com.c2soft.ncmx.exch.jms.JmsSender;
import com.c2soft.ncmx.exch.pojo.Order;

public class MainActiveMqClient {
	
	public static void main(String[] args) {
		
		ApplicationContext context = new AnnotationConfigApplicationContext(JmsConfigForTest.class);
		
		
		JmsSender jmsSender = (JmsSender) context.getBean("jmsSender");
		
		int[] numTimes={0,1,2,3,4,5,6,7,8,9};
		for(int i:numTimes){
		//Order order=new Order("BUY", "ordrId"+i, new BigDecimal("100").add(new BigDecimal(i)), 245,  new DateTime(new Date()),);
			Order orderBuy=new Order("BUY", "ordrId"+i,"NOT_EXECUTED" ,new BigDecimal("100").add(new BigDecimal(i)), new BigDecimal("120").add(new BigDecimal(i)), 245,  new DateTime(new Date()));
			jmsSender.sendObject(orderBuy);
			Order orderSell=new Order("SELL", "ordrId"+i,"NOT_EXECUTED", new BigDecimal("100").add(new BigDecimal(i)), new BigDecimal("120").add(new BigDecimal(i)), 245,  new DateTime(new Date()));
			jmsSender.sendObject(orderSell);
		}
		
		// @Devs
		//Here you can write your use cases and your Buy and sell order and will be picked from exchg server
		
	}
	
	
	

}
